home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / listings / v_09_08 / phil3.c < prev    next >
Text File  |  1991-06-19  |  4KB  |  116 lines

  1.  
  2. Listing 3 - The Function display_menu_for_display_function (file
  3. display.c)
  4.  
  5.  
  6.  
  7.    /***********************************************
  8.    *
  9.    *   display_menu_for_display_image(
  10.    *
  11.    ************************************************/
  12.  
  13.  
  14. display_menu_for_display_image(image_colors, display_colors,
  15.                               invert, color_transform, 
  16.                               monitor_type, 
  17.                               show_hist)
  18.    char color_transform[], monitor_type[];
  19.    int  *invert, *image_colors, *display_colors, *show_hist;
  20. {
  21.    char response[80];
  22.    int  int_response, not_finished, r;
  23.  
  24.    not_finished = 1;
  25.    while(not_finished){
  26.       printf("\n\nDISPLAY> Enter choice (0 for no change) ");
  27.       printf("\nDISPLAY> 1. Invert is %d (1=on 0=off)", *invert);
  28.       printf("\nDISPLAY> 2. Color Transform-- %s", 
  29.              color_transform);
  30.       printf("\nDISPLAY> 3. Input image has %d colors", 
  31.              *image_colors);
  32.       printf("\nDISPLAY> 4. Display will show %d colors", 
  33.              *display_colors);
  34.       printf("\nDISPLAY> 5. Monitor type is %s",
  35.              monitor_type);
  36.       printf("\nDISPLAY> 6. Histogram is %d", *show_hist);
  37.       printf("  (1=show 0=don't show)");
  38.       printf("\nDISPLAY> _\b");
  39.       get_integer(&r);
  40.  
  41.       if(r == 0){
  42.          not_finished = 0;
  43.       }
  44.  
  45.       if(r == 1){
  46.          printf("\nDISPLAY> Enter 1 for invert on");
  47.          printf(" 0 for invert off");
  48.          printf("\nDISPLAY> ___");
  49.          get_integer(&int_response);
  50.          *invert = int_response;
  51.       }  /* ends if r == 1 */
  52.  
  53.       if(r == 2){
  54.          printf("\nDISPLAY> Enter the new color transform mode ");
  55.          printf("\nDISPLAY> (S) Straight mode");
  56.          printf("   (H) Histogram Equalization");
  57.          printf("\nDISPLAY> _\b");
  58.          read_string(response);
  59.          if((response[0] == 'S') ||
  60.             (response[0] == 's'))
  61.                strcpy(color_transform, "Straight mode");
  62.          else
  63.                strcpy(color_transform,
  64.                 "Histogram Equalization mode");
  65.       }  /* ends if r == 2  */
  66.  
  67.       if(r == 3){
  68.          printf("\nDISPLAY> Enter the number of colors");
  69.          printf(" in the input image");
  70.          printf("\nDISPLAY> ___");
  71.          get_integer(&int_response);
  72.          *image_colors = int_response;
  73.       }  /* ends if r == 3 */
  74.  
  75.       if(r == 4){
  76.          printf( 
  77.           "\nDISPLAY> Enter the number of colors for the display");
  78.          printf("\nDISPLAY> ___");
  79.          get_integer(&int_response);
  80.          *display_colors = int_response;
  81.       }  /* ends if r == 4 */
  82.  
  83.       if(r == 5){
  84.          printf("\nDISPLAY> Enter the new monitor type");
  85.          printf("\nDISPLAY> (E) EGA   (V) VGA");
  86.          printf("   (C) CGA   (M) Monochrome");
  87.          printf("\nDISPLAY> _\b");
  88.          read_string(response);
  89.          if((response[0] == 'E') ||
  90.             (response[0] == 'e'))
  91.             strcpy(monitor_type, "EGA");
  92.       if((response[0] == 'V') ||
  93.          (response[0] == 'v'))
  94.             strcpy(monitor_type, "VGA");
  95.       if((response[0] == 'C') ||
  96.          (response[0] == 'c'))
  97.             strcpy(monitor_type, "CGA");
  98.       if((response[0] == 'M') ||
  99.          (response[0] == 'm'))
  100.             strcpy(monitor_type, "Monochrome");
  101.       }  /* ends if r == 5  */
  102.  
  103.       if(r == 6){
  104.          printf(
  105.             "\nDISPLAY> Enter 1 for show histogram 0 for don't");
  106.          printf("\nDISPLAY> ___");
  107.          get_integer(&int_response);
  108.          *show_hist = int_response;
  109.       }  /* ends if r == 6 */
  110.  
  111.  
  112.  
  113.    }  /* ends while not_finished  */
  114. }  /* ends display_menu  */
  115.  
  116.